home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $Dup_Test < prev    next >
Encoding:
Text File  |  1992-12-07  |  547 b   |  29 lines  |  [TEXT/KEEN]

  1. #$Dup_Test: how is last line treated
  2.  
  3. BEGIN {
  4.     undoFile = ARGV[1];
  5.     LoadUndoFileLines()
  6.     PrintUndoneVersionOfFile()
  7.     }
  8.  
  9. function LoadUndoFileLines()
  10.     {
  11.     while ((getline < undoFile) > 0)
  12.         out[++outLines] = $0
  13.     
  14.     ##addedDummyLine
  15.     ##++outLines # to compensate, last line of undone version is printed without \n
  16.     }
  17.  
  18. # Reverted version is sent to stdout.
  19. function PrintUndoneVersionOfFile(    i)
  20.     {
  21.     ##UNDER TEST
  22.     ##--outLines;
  23.     print outLines
  24.     ##for (i = 1; i < outLines; ++i)
  25.     for (i = 1; i <= outLines; ++i)
  26.         print out[i]
  27.     ##printf out[outLines]
  28.     }
  29.